﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using Nova_Common;
using Nova_BLL;
using Nova_DAL;
using Nova_MOD;

public partial class System_Menu_List : System.Web.UI.Page
{
    DataSet ds = new DataSet();
    Nova_MOD.Page Nova_MOD_Page = new Nova_MOD.Page();
    Nova_BLL.Page Nova_BLL_Page = new Nova_BLL.Page();
    protected int iCount = 0;
    protected string strSQL = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            getRecordCount();
            gv_Bind();
        }
    }

    protected void getRecordCount()
    {
        Nova_MOD_Page.tblName = "tbMenu,tbUser";
        Nova_MOD_Page.fldName = "id";
        Nova_MOD_Page.PageSize = pager.PageSize;
        Nova_MOD_Page.PageIndex = pager.CurrentPageIndex;
        Nova_MOD_Page.IsReCount = true;
        Nova_MOD_Page.OrderType = false;
        Nova_MOD_Page.strWhere = getSQL(); 

        ds = Nova_BLL_Page.PageDatasource(Nova_MOD_Page);
        pager.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
        
    }

    private string getSQL() //列表查询
    {
        strSQL = "1=1";

        strSQL += " and id>1";


        return strSQL;
    }

    protected void gv_Bind()
    {
        Nova_MOD_Page.tblName = "tbMenu,tbUser";
        Nova_MOD_Page.fldName = "id";
        Nova_MOD_Page.PageSize = pager.PageSize;
        Nova_MOD_Page.PageIndex = pager.CurrentPageIndex;
        Nova_MOD_Page.IsReCount = false;
        Nova_MOD_Page.OrderType = false;
        Nova_MOD_Page.strWhere = getSQL();

        ds = Nova_BLL_Page.PageDatasource(Nova_MOD_Page);
        gvMenu.DataSource = ds;
        gvMenu.DataBind();

    }
    protected void pager_PageChanged(object sender, EventArgs e)
    {
        gv_Bind();
    }
}
